package com.hourupdate.network.server;

import java.net.*;

import org.apache.log4j.Logger;

public class IMAServer {
	static final Logger logger = Logger.getLogger(IMAServer.class);
    private static final int PORT = 4002;

    public static void main(String args[]) throws Exception {
        ServerSocket servSocket = new ServerSocket(PORT);
        logger.info("Server waiting for client on port " + servSocket.getLocalPort());

        while (true) {
            //  Waiting for Client
            Socket connect = servSocket.accept();
            logger.info("New connection Accepted from " + connect.getInetAddress());
            //  Create Handler
            IMAHandler handler = new IMAHandler(connect);

            handler.start();
        }
    }
}
